#ifndef POPUPMANAGER_H
#define POPUPMANAGER_H

#include <QObject>
#include <QObject>
#include <QQueue>

class PopupManager : public QObject {
    Q_OBJECT
    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
    Q_PROPERTY(QString message READ message NOTIFY messageChanged)

public:
    static PopupManager& instance() {
        static PopupManager instance;
        return instance;
    }

    Q_INVOKABLE void showPopup(const QString& title, const QString& message);
    Q_INVOKABLE void hidePopup();
    Q_INVOKABLE void hideAllPopups();

    QString title() const { return title_; }
    QString message() const { return message_; }

signals:
    void showPopupSignal();
    void hidePopupSignal();
    void titleChanged();
    void messageChanged();

private:
    PopupManager(QObject* parent = nullptr) : QObject(parent), showingPopup_(false) {}
    PopupManager(const PopupManager&) = delete;
    PopupManager& operator=(const PopupManager&) = delete;


    QString title_;
    QString message_;
    QQueue<QPair<QString, QString>> popupQueue_;
    bool showingPopup_;
};

#endif // POPUPMANAGER_H
